﻿<%@ Page Language="C#" MasterPageFile="~/cms/cms.master" AutoEventWireup="true" CodeFile="loaihinhDT.aspx.cs" Inherits="cms_dantoc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="main-title">Cập nhật danh mục loại hình Đào tạo:</div>
    <div class="main-content">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="loaihinhDTID" 
                    Width="100%" AllowPaging="True" DataSourceID="sdsSource">
                    <Columns>
                        <asp:TemplateField HeaderText="ID">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblID" Text='<%# Eval("loaihinhDTID") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle Width="30px" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên loại hình đào tạo">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblName" Text='<%# Eval("loaihinhDT") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="txtName" Text='<%# Bind("loaihinhDT") %>'
                                 Width="350px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvName" ControlToValidate="txtName"
                                 runat="server" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox runat="server" ID="txtNameAdd" Width="350px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvNameAdd" ControlToValidate="txtNameAdd"
                                 runat="server" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                            </FooterTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Sửa">
                            <EditItemTemplate>
                                <div style="width:55px; text-align:center;">
                                    <asp:LinkButton ID="lbtUpdate" runat="server" CausesValidation="False" 
                                        CommandName="Update" ToolTip="Lưu thay đổi">
                                        <img alt="Ghi lại thay đổi" src="../images/save.gif" style="border:none;" />
                                    </asp:LinkButton>
                                    <asp:LinkButton ID="lbtCancel" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" ToolTip="Bỏ qua">
                                        <img alt="Hủy bỏ" src="../images/cancel.gif" style="border:none;" />
                                    </asp:LinkButton>
                                </div>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="lbtEdit" runat="server" CausesValidation="False" 
                                    CommandName="Edit" ToolTip="Sửa">
                                    <img alt="Sửa thông tin" src="../images/updaterow.gif" style="border:none;" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <FooterTemplate>
                                <div style="width:55px; text-align:center;">
                                    <asp:LinkButton ID="lbtInsert" runat="server" CausesValidation="False" 
                                        CommandName="Insert" ToolTip="Lưu" onclick="lbtInsert_Click">
                                        <img alt="add" src="../images/save.gif" style="border:none;" />
                                    </asp:LinkButton>
                                    <asp:LinkButton ID="lbtCancel" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" ToolTip="Bỏ qua" onclick="lbtCancel_Click">
                                        <img alt="cancel" src="../images/cancel.gif" style="border:none;" />
                                    </asp:LinkButton>
                                </div>
                            </FooterTemplate>
                            <ItemStyle Width="60px" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Xóa">
                            <ItemTemplate>
                                <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" 
                                    CommandName="Delete" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa?');">
                                    <img alt="Xóa" src="../images/delete_over.gif" style="border:none;" title="Xóa dòng này" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle Width="30px" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="gridHeader" />
                    <RowStyle CssClass="gridRow" />
                    <PagerStyle CssClass="gridPage" />
                    <FooterStyle CssClass="gridFooter" />
                    <EmptyDataTemplate>
                        Chưa có dữ liệu trong hệ thống!
                    </EmptyDataTemplate>
                </asp:GridView>
                <div class="gridviewAddNewButton">
                    <asp:Button ID="btnNewRow" runat="server" Text="Thêm dòng" 
                        onclick="btnNewRow_Click" />
                </div>
                <asp:SqlDataSource ID="sdsSource" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:hotb %>" DeleteCommand="_loaihinhDTDelete" 
                    DeleteCommandType="StoredProcedure" InsertCommand="_loaihinhDTSave" 
                    InsertCommandType="StoredProcedure" SelectCommand="_loaihinhDTGetList" 
                    SelectCommandType="StoredProcedure" UpdateCommand="_loaihinhDTSave" 
                    UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="loaihinhDTID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="loaihinhDTID" Type="Int32" />
                        <asp:Parameter Name="loaihinhDT" Type="String" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="loaihinhDTID" Type="Int32" DefaultValue="0" />
                        <asp:Parameter Name="loaihinhDT" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>

